package
{
	import Common.ActionManager;
	import Common.GameCreatureAction;
	
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.MovieClip;
	import flash.geom.Point;
	import flash.geom.Rectangle;

	public class LoginRole extends GameCreatureAction
	{
		public var parent:Object = null;
		public var bitmap:Bitmap = null;
		
		public var rect:Rectangle = null;
		public var point:Point = null;
		
		public var select:Boolean = false;
		public var color:int = 0;
		
		public function LoginRole()
		{
			rect = new Rectangle();
			point = new Point();
			bitmap = new Bitmap();
			
		}
		
		
		public function initRole( p:Object ):void
		{
			parent = p;
			parent.addChild( bitmap );
		}
		
			
		public override function ActionChange():void
		{
			super.ActionChange();
			
			var imgData:Object = ActionManager.instance.bmpData[ textureID ];
			
			rect.width = imgData.w;
			rect.height = imgData.h;
			
			bitmap.bitmapData = imgData.bd;
			bitmap.x = imgData.px;
			bitmap.y = imgData.py;
			
			parent.graphics.clear();
			
			if ( select )
			{
				parent.graphics.lineStyle( 1 , 0x00ff00 );
				parent.graphics.moveTo( bitmap.x - 2 , bitmap.y);
				parent.graphics.lineTo( bitmap.x - 2 + imgData.w , bitmap.y );
				parent.graphics.lineTo( bitmap.x - 2 + imgData.w , bitmap.y + imgData.h );
				parent.graphics.lineTo( bitmap.x - 2 , bitmap.y + imgData.h );
				parent.graphics.lineTo( bitmap.x - 2 , bitmap.y );
			}
			
		}
		
	}
}